//
//  WJYRadioCollectionViewCell.m
//  WWLNetease
//
//  Created by dllo on 15/12/28.
//  Copyright © 2015年 Echo.Jobs. All rights reserved.
//

#import "WJYRadioCollectionViewCell.h"

@interface WJYRadioCollectionViewCell()

@property (nonatomic, retain) UIImageView *bigView;
@property (nonatomic, retain) UILabel *titleL;
@property (nonatomic, retain) UILabel *detailL;
@end

@implementation WJYRadioCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        [self createRadioCollectionViewCell];
    }
    return self;
}

- (void)createRadioCollectionViewCell{
    self.bigView = [[UIImageView alloc]init];
    [self addSubview:self.bigView];
    [self.bigView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(self);
        make.bottom.equalTo(self.mas_centerY).offset(25 * SIZE);
        
    }];
    self.bigView.backgroundColor = [UIColor blueColor];
    
    
    
    self.titleL = [[UILabel alloc]init];
    [self addSubview:self.titleL];
    [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.bigView).offset(5);
        make.top.equalTo(self.bigView.mas_bottom).offset(2);
        make.right.equalTo(self.bigView).offset(2);
        make.height.equalTo(@15);
        
    }];
    self.titleL.font = [UIFont systemFontOfSize:13];
    
    
    self.detailL = [[UILabel alloc]init];
    [self addSubview:self.detailL];
    [self.detailL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.titleL);
        make.top.equalTo(self.titleL.mas_bottom).offset(3);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-2);
    }];
    self.detailL.font = [UIFont systemFontOfSize:12];
    self.detailL.numberOfLines = 0;
    self.detailL.textColor = [UIColor colorWithWhite:0.620 alpha:1.000];
    
}

- (void)setRadioMdoel:(WJYRadioModel *)radioMdoel{
    NSURL *url = [NSURL URLWithString:radioMdoel.image];
    [self.bigView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeHoderImage.jpg"]];
    
    self.titleL.text = radioMdoel.title;
    
    
    
    CGFloat height = [AdjustLabelWidthToFitFontAppTools heightForContent:radioMdoel.subTitle width:self.contentView.frame.size.width - 100 - 10 - 2 fontSize:40 * SIZE];
    CGRect frame = self.detailL.frame;
    frame.size.height = height;
    self.detailL.frame = frame;
    self.detailL.text = radioMdoel.subTitle;
    
}


@end
